﻿<!DOCTYPE html>
<html lang="en">

<head>
	<title></title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description" content="Free landing page website template">
	<meta name="author" content="The Develovers">
	<!-- CORE CSS -->
	<link href="assets/css/bootstrap.css" rel="stylesheet" type="text/css">
</head>
<body>
	<div class="container">
	   <div class="dialog">
            <div class="panel panel-default">
                <p class="panel-heading no-collapse">在线充值</p>
                <div class="panel-body">
                    <form id="frmMain" method="post" name="frmMain">
                        <div class="form-group">
                            <label>账号</label>
                            <input type="text" class="form-control span12" id="username" name="username" readonly>
                        </div>
                        <div class="form-group">
                            <label>充值金额(RMB)</label>
                            <input type="text" class="form-control span12" id="rechargeMoney" value="" name="rechargeMoney">&nbsp;元
                            <span class="red pl10">最小充值:<span id="minAmountSpan" runat="server" class="spanWarning">1</span>元</span>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                 <div class="col-xs-4">
                                   <div class="radio">
                                       <label>
                                          <input type="radio" name="payType" id="shengpay" 
                                             value="WECHATQR" checked>
                                             微信
                                       </label>
                                    </div>
                                    <div class="radio">
                                       <label>
                                          <input type="radio" name="payType" id="alipay" 
                                             value="ALIPAY" >支付宝
                                       </label>
                                    </div>
                                 </div>
                                 <div class="col-xs-8">
                                     
                                 </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <input id="btnOnlinePaySubmit" type="submit" value="充值" class="btn btn-primary"/>
                        </div>
                    </form>
                </div>
            </div>
        </div>
	</div>
	<!-- JAVASCRIPT -->
	<script src="assets/js/jquery-2.1.1.min.js"></script>
	<script src="assets/js/bootstrap.min.js"></script>
	<script type="text/javascript">
  var username = getUrlParam('userid');
  var rechargeMoney = getUrlParam('rechargeMoney');
  var payType = getUrlParam('payType');
  $("#"+payType).attr("checked","checked");
  $("#username").val(username);
  $("#rechargeMoney").val(rechargeMoney);
	$("#btnOnlinePaySubmit").click(function () {

        if ($("#btnOnlinePaySubmit").attr("disabled") == "disabled") return;

        var minAmount = $("#minAmountSpan").text() == "" ? 10 : parseInt($("#minAmountSpan").text());;

        var isNumberic = true;
        var amount = $("#rechargeMoney").val();
        var reg = /^[1-9]\d{0,6}$/;
        if (!reg.test(amount)) {
            isNumberic = false;
        }
        if (!reg.test(amount)) {
            isNumberic = false;
        }
        if (amount < minAmount || amount > 1000000) {
            isNumberic = false;
        }
        if (!isNumberic) {
            alert('充值金额不合法');
            return false;
        }
        if(amount!="18" && amount!="38" && amount!="68" && amount!="128" && amount!="368" && amount!="788" && amount!="320"){
            alert('充值金额不合法');
            return false;
        }

        $("#btnOnlinePaySubmit").val("提交中.....");
        $("#btnOnlinePaySubmit").attr("disabled", "true");
        $("#frmMain").attr("action", "http://dd.zhangkunsujiao.com/iwmpay/post.asp");
        $("#frmMain").submit();
    });
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }
    $("#btnOnlinePaySubmit").click();
	</script>
</body>
</html>

